import TableTypes from "../../../model/TableTypes.ts";
import Header from "./Header.tsx";
import Row from "./Row.tsx";
import {TableData} from "../../../model/TableData.ts";




const Table  = (props: { type: TableTypes, data: TableData[], modalTrigger: (arg: TableData) => void, updateDataOnPage: () => void}) => {

    const {type, data, modalTrigger, updateDataOnPage} = props


    return (


        <table className="table">


            <thead>
            <Header type={type}/>


            </thead>
            <tbody>

            {

                data.map((row) => (
                    <Row modalTrigger={modalTrigger} updateDataOnPage={updateDataOnPage} type={type} row={row}/>
                ))
            }
            </tbody>
        </table>


    )
}

export default Table